from utils.pagebase import PageBase
from selenium.webdriver.common.by import By


class PageForm(PageBase):
    path_url = "/webzdh/form.html"
    idDW = By.ID, 'username'
    mimaDW=By.ID, 'pwd'
    typedate='radio'
    namedate='sex'
    nameAttr='aihao'
    typeAttr='checkbox'
    scDW=By.ID, 'zaopian'


    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)

        #打开网站
    def openurl(self):
        self.open(PageForm.path_url)

        #输入账户
    def input_zhanghao(self,zh):
        self.input(PageForm.idDW,zh)

        #输入密码
    def input_mima(self,pwd):
        self.input(PageForm.mimaDW,pwd)

        # 单选按钮
    def click_sex(self,valueAttr):
        self.click_dx(PageForm.typedate,PageForm.namedate,valueAttr)

        # 复选按钮
    def click_aihao(self,targetValues):
        self.click_fx(PageForm.nameAttr,PageForm.typeAttr,targetValues)



        #上传文件
    def upload_zhaopian(self,file):
        self.upload_file(PageForm.scDW,file)


        #上传文件2
    def uploadzhaopian(self,file):
        self.upload_autoid(PageForm.scDW,file)

            #封装截图
    def jietu_now(self,name):
        self.jietu(name)

